Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-39203] Mark JUnit steps with failing tests with WarningAction #118

Merged
merged 6 commits into from May 13, 2019

Conversation

dwnusbaum
Copy link
Member

@dwnusbaum dwnusbaum commented Apr 19, 2019

See jenkinsci/workflow-api-plugin#91 and JENKINS-39203. (I am intentionally not updating the status of that ticket or assigning it to myself until I am ready to merge/release all relevant changes to avoid giving users premature hope of a fix and so that I have clear answers for what will and won't work and when any fixes will be released.) Subsumes and is based on #96.

This PR adds a WarningAction to the StepAtomNode for junit steps with failing tests so that the actual stage containing the junit step can be visualized as unstable via jenkinsci/pipeline-graph-analysis-plugin#25.

Desired reviewers: @abayer, @jglick, @car-roll

@dwnusbaum
Copy link
Member Author

CI failure is because my Jenkinsfile changes are being ignored and the builds on 2.60.x are failing because plugins aren't able to load correctly.

if (testResultAction.getResult().getFailCount() > 0) {
int testFailures = testResultAction.getResult().getResultByNode(nodeId).getFailCount();
if (testFailures > 0) {
node.addOrReplaceAction(new WarningAction(testFailures + " tests failed"));
run.setResult(Result.UNSTABLE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option would be for WarningAction.onAttached to call Run.setResult automatically. On the other hand I can imagine wanting this drastic effect to be explicit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't familiar with onAttached previously, but I think you are referring to RunAction2.onAttached. We certainly could make some changes in FlowNode so that onAttached and onLoad would be called for actions implementing RunAction2, but as you mentioned I think this particular effect is best left explicit.

@jglick
Copy link
Member

jglick commented Apr 22, 2019

my Jenkinsfile changes are being ignored

Ask to become a maintainer.

@jglick
Copy link
Member

jglick commented May 3, 2019

Looks like you have some POM problems.

Structs Plugin v1.17 failed to load.
 - You must update Jenkins from v2.60.1 to v2.60.3 or later to run this plugin.
java.lang.NoSuchMethodError: jenkins.model.Jenkins.get()Ljenkins/model/Jenkins;
	at org.jenkinsci.plugins.workflow.cps.nodes.StepDescriptorCache.getPublicCache(StepDescriptorCache.java:48)

@dwnusbaum
Copy link
Member Author

No, just Jenkinsfile problems (https://github.com/jenkinsci/junit-plugin/pull/118/files#diff-58231b16fdee45a03a4ee3cf94a9f2c3L1). I'll request to be a maintainer so my Jenkinsfile changes are used.

@dwnusbaum dwnusbaum closed this May 9, 2019
@dwnusbaum dwnusbaum reopened this May 9, 2019
Copy link
Member

@abayer abayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels very familiar for some reason... =)

@dwnusbaum dwnusbaum merged commit e6d845e into jenkinsci:master May 13, 2019
@dwnusbaum dwnusbaum deleted the JENKINS-39203 branch May 13, 2019 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants